<template>
    <div>
        <div class="header-info">
            <p>配置</p>
        </div>
        <el-row :gutter="12" type="flex" ref="card">
            <el-col>
                <el-card shadow="always">

                    <kv label="验证码">
                        <selector type="radio" chk="*" v-model="info.needValidateCode" :clearable="false"
                                  :data="{true:'需要',false:'不需要'}"/>
                    </kv>
                    <el-button size="mini" @click="save_click" type="primary"> 保存</el-button>
                </el-card>
            </el-col>
        </el-row>
    </div>
</template>
<style scoped>
    >>> .kv .k {
        flex: 4 !important;
        min-width: auto !important;
    }
</style>
<script>


    export default {
        components: {},
        props: {
            id: {type: String, default: ""}
        },
        data() {
            return {
                info: {}, //子对象需要声明。

            }
        },
        computed: {},
        mounted() {
            this.loadData();
        },
        methods: {
            loadData() {
                this.$http.post("/site/config/get").then(res => {
                    this.info = res.data.data;
                });
            },
            save_click() {
                //校验
                if (this.$refs.card.chk() == false) {
                    return;
                }

                this.$http.post("/site/config/set", this.info).then(res => {
                    jv.info("设置成功")
                    this.loadData();
                })
            },
            // edit_click(row) {
            //     //记录上次点击行
            //     var rowId = row.id;
            //     this.$refs.list.setLastRow(row);
            //     this.$router.push("/site/b_site_folder/edit/" + rowId)
            // },
            // delete_click(row) {
            //     var rowId = row.id;
            //     var rowName = row.name;
            //     jv.confirm('确认删除 ' + rowName + ' 吗？').then(res => {
            //         this.$http.post("/site/b_site_folder/delete/" + rowId).then(res => {
            //             this.loadData();
            //         })
            //     });
            // },
        }
    }
</script>
